<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Login
 *
 * @author antonio
 */
class Logar extends IAbstractInterface implements IIntfacePagina{
    
    
    public function __construct($server, $banco, $login, $senha, $parametros = "") {
        parent::__construct($server, $banco, $login, $senha, $parametros);
        $this->gerarPagina();
    }


    
    public function gerarPagina() {
        
        $con  = new Conexcao($this->server,
                $this->banco,
                $this->login,
                $this->senha);
                
        $login = new Login($_POST['login'], $_POST['senha'], $con);
        
        $login->logar();
        
        if($login->status){

            echo '<script>window.location = "http://'.$_SERVER["HTTP_HOST"].'/sistema";</script>';
                    
        }else{
            echo '<script>alert("login ou password invalido");</script>';
            echo '<script>window.location = "http://'.$_SERVER["HTTP_HOST"].'";</script>';
        }
    }    //put your code here
}

?>
